// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// V1Device v1 device
//
// swagger:model v1Device
type V1Device struct {

	// entered at
	// Format: date-time
	EnteredAt strfmt.DateTime `json:"enteredAt,omitempty"`

	// id
	ID string `json:"id,omitempty"`

	// platform
	Platform string `json:"platform,omitempty"`

	// user Id
	UserID string `json:"userId,omitempty"`
}

// Validate validates this v1 device
func (m *V1Device) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateEnteredAt(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *V1Device) validateEnteredAt(formats strfmt.Registry) error {
	if swag.IsZero(m.EnteredAt) { // not required
		return nil
	}

	if err := validate.FormatOf("enteredAt", "body", "date-time", m.EnteredAt.String(), formats); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this v1 device based on context it is used
func (m *V1Device) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *V1Device) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *V1Device) UnmarshalBinary(b []byte) error {
	var res V1Device
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
